package com.nuc.bigdata.feign;

import com.nuc.bigdata.feign.dto.ShopCarGoodsDto;
import com.nuc.bigdata.feign.entity.ShopCarFeign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author JackLuo
 * @date 2019/12/5
 */
@FeignClient("oa-shopping-cart")
public interface ShopCarServiceFeign {
    @GetMapping("/oa-shopping-cart/car/{userId}")
    ShopCarFeign queryByUserId(@PathVariable("userId")String userId);

    @PostMapping("/oa-shopping-cart/car/{userId}/goods")
    void addGoodsIntoCar(@RequestBody ShopCarGoodsDto goodsDto,
                                @PathVariable("userId")String userId);

    @DeleteMapping("/oa-shopping-cart/car/{userId}/goods/{commodityId}")
    void removeGoodsFromCar(@PathVariable("commodityId")String commodityId,
                                   @PathVariable("userId")String userId);

    @PutMapping("/oa-shopping-cart/car/{userId}/goods/{commodityId}/quantity/{quantity}")
    void updateGoodsInCar(@PathVariable("commodityId")String commodityId,
                                 @PathVariable("userId")String userId,
                                 @PathVariable("quantity")Long quantity);

    @PutMapping("/oa-shopping-cart/car/{userId}/goods/{commodityId}/selected")
    void updateGoodsSelectedInCar(@PathVariable("commodityId")String commodityId,
                                         @PathVariable("userId")String userId,
                                         @RequestParam("selected") Boolean selected);
}
